package com.authine.cloudpivot.ext.constants;

/**
 * @author Adam.yao
 * @date 2017/10/25
 */
public class WebConstants {

    public static final String REMOTE_IP_HEADER = "X-Forwarded-For";
    ;
    public static final String ORIGINAL_IP_HEADER = "x-Original-Forwarded-For";
    public static final String INDEX_PAGE = "index";
    public static final String FORM_PAGE = "fragments/form";
    public static final String MAIN_PAGE = "main";
    public static final Integer DEF_PAGE = 1;
    public static final Integer DEF_SIZE = 20;
    public static final String DEF_SORT = "id";
    public static final String DEF_DIRECTION = "DESC";

    public static Integer validatePage(Integer page) {
        return page == null || page <= 0 ? DEF_PAGE : page;
    }
}
